#include <stdlib.h>
#include <stdio.h>
#include <syslog.h>
int main(int argc, char** argv)
{
	//void openlog(const char *ident, int option, int facility);
	const char * service_name = "sonicomvpn";
	
	openlog(service_name, LOG_PID | LOG_CONS | LOG_NDELAY, LOG_LOCAL3);
	syslog(LOG_WARNING, "[warning]test rsyslog in C from exec %s", argv[0] );
	syslog(LOG_INFO, "[info]test rsyslog in C from exec %s", argv[0] );
	//********************/etc/rsyslog.conf and terminal output***********************
	//# Log anything (except mail) of level info or higher.
	//# Don't log private authentication messages!
	//*.info;mail.none;authpriv.none;cron.none;local0.none;local3.none           /var/log/messages
	//local0.info						/var/log/log_audit
	//local3.warning                                          /var/log/rsyslogtest.log
	
	//[hhh003@host log]$ sudo more rsyslogtest.log 
	//Jun  1 05:54:38 huhao sonicomvpn[20540]: [warning]test rsyslog in C from exec ./rsyslogtest
	//*********************************************************************************
	closelog();
    return 0;
}

//********************rsyslog network package***********************
//	09:35:56.805065 IP 192.168.1.11.52368 > 192.168.1.220.syslog: SYSLOG local0.info, length: 151
//	0x0000:  4500 00b3 bedf 4000 4011 f722 c0a8 010b  E.....@.@.."....
//	0x0010:  c0a8 01dc cc90 0202 009f 80e3 3c31 3334  ............<134
//	0x0020:  3e4a 756e 2020 3420 3231 3a33 383a 3030  >Jun..4.21:38:00
//	0x0030:  2073 6f6e 6963 6f6d 7670 6e20 6164 6d69  .sonicomvpn.admi
//	0x0040:  6e5f 646f 5f73 6865 6c6c 5f63 6d64 3a20  n_do_shell_cmd:.
//	0x0050:  5b2f 686f 6d65 2f61 646d 696e 5d20 434f  [/home/admin].CO
//	0x0060:  4d4d 414e 445f 4c4f 476c 5b6e 756d 2074  MMAND_LOGl[num.t
//	0x0070:  696d 6520 686f 7374 2063 6f6d 6d61 6e64  ime.host.command
//	0x0080:  5d20 2031 3033 2020 5b32 3032 312d 3036  ]..103..[2021-06
//	0x0090:  2d30 3420 3231 3a33 383a 3030 5d20 5b31  -04.21:38:00].[1
//	0x00a0:  3932 2e31 3638 2e31 2e32 3439 5d20 6865  92.168.1.249].he
//	0x00b0:  6c6c 6f                
//*********************************************************************************
